import { zh_CN } from 'antd/es/locale/zh_CN';



// string null undefined boolean bigint symbol number   
// any never void unknown
// enum interface type 
// in keyof typeof


// 强类型语言

// number :  byte(1) smallint(2) float(4)  int (4) long(8) double(8)


// TS -> 编译 －> JS


// 声明
const sss:null = null;
var ss:number = 100;


//  getType     
// 获取用户地址类型
// arguments

// - arg1   `number`  required   defaultValue   description "用户的ID"
// - arg2   `string`  required   defaultValue   description "家地址"

// return
// 类型 void   null | string  


getType(1, "随州")




function getDLJ(name:string){
    console.log('How beautiful you are!!!')
}
const getDLJ2 = (name:string)=>{

}

type DLJFunction = (name:string)=>string;

interface DLJFunction2 {
    (name:string):string;
}

const getFFF:DLJFunction = (name)=>{
    return 20+'';
}

const getFF2:DLJFunction2 = () =>{
    return ''
}

const axx = getFFF('100');


function getType(arg1:number, arg2?:string){
    // 调 Http get
    let type:string|null ;
    type= "super";
  return type;
}
function getType2(arg1, ...arg2){
    return;
  }
const aa = getType(1, 2);





interface A1 {
    age:number;
}
var a:number = 100;

/**
 * 获取名字参数接口
 */
interface GetNameOptions{
    /**
     * 姓名
     */
    name?:string;
}
/**
 * 获取名称
 * @param options
 * @returns 
 */
function getName(options:GetNameOptions){
    const cc = options.name
    if(options.name){
        const ss = options.name;
        const ww = cc as string;
        const pp = cc!;
        const dd = pp?.split('')
        const pp2 = <string>cc;
    }
    if(a===100){
        return 20;
    }
    return 100;
}

// 1. 
// 编译环境: 
//　运行环境








interface Payment{
    from:string;
    to:string;
    title:string;
    content:string;
    sendTime:string;
    startAddr:string;
    readonly endAddr:string;

    say():void;
    get?(name:string):void;
    get2?:(name:string)=>void;

    // [index:string]:any;
}

type Payment2 = {
    from:string;
    to:number;
    say():void;
    get?(name:string):void;
    get2?:(name:string)=>void;

    // [index:string]:any;
}

type Payment3 = Payment | Payment2;

type Payment4 = Payment & Payment2;

const vvv:Payment4={
    from:'',
    say(){},
    title:'',
    content:'',
    sendTime:'',
    startAddr:'',
    endAddr:'',
    to:''
}


type A = number | string;  // 联合
type AB= number & string; // 交叉


interface Result<T=any> {
    name:T;
}

type TypeResult<T=any> = {
    name:T;
}


interface StringResult {// Result<string>
    name:string;
}
interface NumberResult {// Result<number>
    name:number;
}
interface BoolResult { // Result<boolean>
    name:boolean;
}

const a:Result<number> = {
    name:78,
}

const a2:Result = {
    name:78,
}

const pay = {
    from:'',
} as any as Payment;

const obj2 = {};
obj2.age = 20;
const obj:Record<string, any> = {};
obj.age = 20;
obj.age1 = 20;
obj.age2 = 20;


const a:string = 'from';

pay['from']

pay.endAddr = '';
pay.say();
if(pay.get2){
    pay.get2('')
}
















